Skip to content

feat: add on_update to the field#1273

Merged
collerek merged 2 commits intoormar-orm:masterfrom
vvanglro:pr532
Apr 21, 2026
Merged

feat: add on_update to the field#1273
collerek merged 2 commits intoormar-orm:masterfrom
vvanglro:pr532

Conversation

@vvanglro
Copy link
Copy Markdown
Contributor

This is a refinement of the #532.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Feb 27, 2024

CodSpeed Performance Report

Merging #1273 will degrade performances by 24.44%

Comparing vvanglro:pr532 (20e90ed) with master (3a206dd)

Summary

⚡ 1 improvements
❌ 1 regressions
✅ 82 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark master vvanglro:pr532 Change
test_get_all_with_related_models[10] 68.2 ms 60.6 ms +12.49%
test_get_or_none[250] 10 ms 13.2 ms -24.44%

Comment thread ormar/models/model.py Outdated
for k, v in self_fields.items()
if k in _columns or k in onupdate_fields
}
if not kwargs and not _columns:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If all are null here, the update is based on user-modified attributes on the instance, with user-modified attributes taking precedence over on_update.

@collerek collerek merged commit c29fc1c into ormar-orm:master Apr 21, 2026
9 of 11 checks passed
collerek added a commit that referenced this pull request Apr 22, 2026
Bump version and add release notes for 0.24.0.

Features:
- on_update field option (#1273)
- fk_name override on ForeignKey (#849)
- forward autoincrement to SQLAlchemy column (#674)

Fixes:
- run standalone queries under AUTOCOMMIT isolation,
  restoring 0.21-era per-row CRUD performance (#1629, #1635)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants